//
//  KDFormDataRequest.h
//  KDTools
//
//  Created by 斌 on 15/11/19.
//  Copyright © 2015年 斌. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class KDFormDataRequest;
@protocol KDFormDataRequestDelegate

/** 完成回调 */
- (void)requestFinished:(KDFormDataRequest *)request;

/** 失败回调 */
- (void)requestFailed:(KDFormDataRequest *)request;

@end


@interface KDFormDataRequest : NSObject

@property (strong, nonatomic) id <KDFormDataRequestDelegate> delegate;
@property (assign, nonatomic) UIProgressView *uploadProgressDelegate;
@property (retain) NSError *error;

- (id)initWithURLString:(NSString *)urlString;

//添加一个POST请求变量
- (void)addPostValue:(NSString *)value forKey:(NSString *)key;
//将本地图片文件的内容添加到请求
- (void)addImageFile:(NSString *)filePath withFileName:(NSString *)name forKey:(NSString *)key;
//添加一个NSData图片对象
- (void)addImageData:(NSData *)data withFileName:(NSString *)name forKey:(NSString *)key;

- (void)startAsynchronous;

- (NSString *)responseString;
- (NSData *)responseData;

- (void)cancel;
@end
